home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.os.vms,comp.sys.dec,comp.lang.c
- Subject: Re: getting correct local time in VAX C program
- Date: Sun, 31 Mar 96 13:19:21 GMT
- Organization: none
- Message-ID: <828278361snz@genesis.demon.co.uk>
- References: <4jec36$ff3@lastactionhero.rs.itd.umich.edu>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4jec36$ff3@lastactionhero.rs.itd.umich.edu>
- raffel@umich.edu "David Raffel" writes:
-
- >
- >I'm having a problem using the c localtime function to convert a
- >"timestamp" (represented in seconds since 1/1/1970) to a date
- >and time. I'm running under VMS V5.5-2 and using VAXC V3.1.
- >
- >The problem is that the timestamp is being written out to a file
- >by a SUN which takes into account timezone information. When I
- >read the timestamp on VMS and convert it, I get the correct date,
- >but the time is off by 5 hours. I assume that this is because
- >the VAX doesn't use any timezone information and always returns
- >GMT.
-
- Or perhaps the VAX represents a time_t value in terms of seconds since
- 1/1/1970 00:00:00 local time rather than GMT as Unix does (just a guess).
- The comp.lang.c answer is that you get no guarantees at all on the
- representation of a time_t value, except that it is an arithmetic type
- (it may not even be an integer).
-
- How do you want to deal with timezones? If the VAX system was in a different
- timezone to the SUN system do you want to reserve the time numericl value
- or the correct time instant? If VMS supports timezone information you
- can use that to adjust to local time, if not then you would either have
- to write a local time value from the SUN or add an extra field supplying
- information about the timezone environment the SUN program was using (or just
- apply your own, preferably configuarble, fudge factor on the VAX).
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-